import time
from tqdm import tqdm, trange, tqdm_notebook
 
if __name__ == '__main__':
    for j in range(3):
        pbar = trange(10, desc=f'Epoch-{j}')
        for i in pbar:
            # print('step i:', i)
            time.sleep(0.5)
            # pbar.set_description('Epoch task %j' % j)
            # pbar.write('finish task %i' % i)
            pbar.set_postfix_str(f'loss={i}')
            if i == 9:
                pbar.set_postfix_str(f'loss=9999')
        # pbar.set_postfix_str(f'loss=9999') # 无效
        pbar.write('\n')
        pbar.close()
